package com.adt;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test31 {
	
	private static List<Integer> l = new ArrayList<>();
	
	private static List<Integer> p = new ArrayList<>();

	public static void main(String[] args) {
		initData();
		
		printLots(l,p);
	}
	
	private static void printLots(List<Integer> l2, List<Integer> p2) {
		Iterator<Integer> l2Iterator = l2.iterator();
		Iterator<Integer> p2Iterator = p2.iterator();
		Integer itemL = null;
		Integer itemP = null;
		int start = 0;
		while(l2Iterator.hasNext()&&p2Iterator.hasNext()){
			itemP = p2Iterator.next();
			while(start<itemP&&l2Iterator.hasNext()){
				start++;
				itemL = l2Iterator.next();
			}
			System.out.println(itemL);
		}
	}

	private static void initData(){
		for(int i = 0;i<10;i++){
			l.add(i);
		}
		
		
		p.add(1);
		p.add(3);
		p.add(4);
		p.add(6);
	}

}
